
//#include <asm/signal.h>
#include <signal.h>
#include <sys/time.h>
#include "timer_driver.h"

int sec;

///////////////////////////////////////////////////////////////////////

int set_timer(int onceflag,int delays,int delayns,int *pfunc)
{

		struct itimerval value, ovalue, value2; 		 //(1)

		signal(SIGALRM, pfunc);

		if (onceflag == 0x01)
		{
			value.it_interval.tv_sec = 0;
			value.it_interval.tv_usec = 0;
		}
		else
		{
		 	value.it_interval.tv_sec = delays;
	    	value.it_interval.tv_usec = delayns;
		}
		
		value.it_value.tv_sec = delays;
	    value.it_value.tv_usec = delayns;

	    setitimer(ITIMER_REAL, &value, &ovalue);    //(2)	

}
	


